<?php

namespace App\Http\Controllers\api;

use App\Http\Controllers\Controller;
use App\Models\api\AgentNews;
use Illuminate\Http\Request;

class AgentNewsController extends Controller
{
    public function agentNewsList()
    {
        $agentNewsData = AgentNews::join('wx_user','wx_user.id','agent_news.user_id')
            ->orderBy('agent_news.a_id','desc')->get()->toArray();
        return ['code'=>'200','msg'=>'Ok','data'=>$agentNewsData];
    }

    public function agentNewsDelete(Request $request)
    {
        $request->except('token');
        $a_id = $request['a_id'];
        $deleteData = AgentNews::where('a_id',$a_id)->delete();
        return ['code'=>'200','msg'=>'OK','data'=>$deleteData];
    }
}
